package com.Maykk.charStream;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @ClassName: Demo
 * @Description: TODO 字符流写入 - write()
 * @Author: MaykkStar@163.com
 */
public class Demo03 {
    public static void main(String[] args) throws IOException {
        // 将获取到的字节流对象封装成字符流对象
        OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream("./Maykk.txt"));

        // 写一个字符
        ow.write(97);
        ow.flush();

        // 写一个字符数组
        char[] charArr = {'a','b','c','d','e','f','g','h','i','j','k','l'};
        ow.write(charArr);
        ow.flush();

        // 写一个字符串
        ow.write("现在正在写入一个字符串");
        ow.flush();

        ow.close();
    }
}
